import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login&Register/login.vue'
import Register from '@/views/login&Register/register.vue'
import Index from '@/views/home.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: Login,
  },
  {
    path: '/login',
    redirect: '/'
  },
  {
    path: '/register',
    name: 'register',
    component: Register,
  },
  {
    path: '/index',
    name: 'index',
    component: Index,
    children: [{
      path: 'main_home',
      name: 'main_home',
      meta: {
        title: '首页',
        path: '/index/main_home'
      },
      component: () =>
        import('@/views/mainViews/MainHome.vue'),
    }, {
      path: 'chose_title',
      name: 'chose_title',
      meta: {
        title: '选题',
        path: '/index/chose_title'
      },
      component: () =>
        import('@/views/mainViews/ChoseTitle.vue'),
    }, {
      path: 'change_title',
      name: 'change_title',
      meta: {
        title: '课题信息变更',
        path: '/index/change_title'
      },
      component: () =>
        import('@/views/mainViews/ChangeTitle.vue'),
    }, {
      path: 'assig_book',
      name: 'assig_book',
      meta: {
        title: '任务书',
        path: '/index/assig_book'
      },
      component: () =>
        import('@/views/processMang/AssigBook.vue'),
    }, {
      path: 'open_report',
      name: 'open_report',
      meta: {
        title: '开题报告',
        path: '/index/open_report'
      },
      component: () =>
        import('@/views/processMang/OpenReport.vue'),
    }, {
      path: 'text',
      name: 'text',
      meta: {
        title: '未完成功能',
        path: '/index/text'
      },
      component: () =>
        import('@/views/processMang/text.vue'),
    },],
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
